/*
 * twist.cpp
 * 
 * Copyright 2012 Maximilian Eisbach <max@itp.tu-berlin.de>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 * 
 * 
 */

#include <mylibs/CardiacMesh.hpp>
#include <mylibs/myinifiles.hpp>
#include <iostream>
#include <fstream>
#include <sys/stat.h> 	// mkdir

using namespace std;

bool verbose = false;

mystring output = mystring();

int main(int argc, char **argv){
	myIniFiles ini(argc, argv);
	
	ini.set_info("Compute the surface of a 3D mesh.");
	ini.register_param("mesh", "m", "Mesh basename without extension.");
	ini.register_param("region", "R", "Region index. May also be a list of indices. (default : all regions)");
	ini.check(2);
	
	
	mystring meshfile;
	meshfile = ini.read("mesh", mystring());
	set<int> regions;
	ini.read("region", regions);
	
	if (meshfile.empty()) ini.print_help("mesh");

	//load the standard input mesh
	CardiacMesh mesh(meshfile, true);
  	SurfaceMesh surface = mesh.compute_surface(regions);
	
	output = "surface";
	surface.save_mesh(output.c_str());
	return 0;
}




